<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Project extends CI_Controller {
	public function index()
	{
		$data['page'] = 'pages/project';
		$this->load->view('mainview', $data);
	}
	
	public function save(){
		$config = $this->input->post();
		//var_dump($config);
		//exit;
		
		$this->load->library('form_validation');
		$this->form_validation->set_rules('nm_project', 'Nome do projeto', 'required');
		$this->form_validation->set_rules('ds_project', 'Descrição do projeto', 'required');
		
		if ($this->form_validation->run() == TRUE)
		{
			$this->load->model('project_model');
			$this->project_model->save($config);
		}
		else
		{
			$data['content'] = validation_errors();
			$this->load->view('mainview', $data);
		}
		
		
	}
}
